package com.sgb.packers.api;

import com.sgb.link.entity.ProjectTakeEntity;
import com.sgb.net.entity.ListResponse;
import com.sgb.packers.entity.ContractLaborEntity;
import com.sgb.packers.entity.PointEntity;
import com.sgb.packers.entity.PressDayCalendarEntity;
import com.sgb.packers.entity.ProjectEntity;
import com.sgb.packers.entity.SalaryStandardEntity;
import com.sgb.packers.entity.WorkRecordsEntity;
import com.sgb.packers.entity.WorkStatisticsEntity;
import com.sgb.packers.entity.WorkTakeEntity;
import com.swgk.core.base.model.entity.BaseEntity;

import java.util.List;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * @author yonghow
 * Description:工队接口
 * @date 2021/6/16
 */
public interface PackersService {

    /**
     * 记工项目列表
     *
     * @param map 参数 {
     *            type	记工类型1:个人记,2:班组记工
     *            }
     * @return
     */
    @POST("settleProjectStandard/getProjectPage")
    Call<BaseEntity<ListResponse<List<ProjectEntity>>>> getProject(@Body Map<String, Object> map);

    /**
     * 添加记工项目
     *
     * @param map 参数 {
     *            no	项目no
     *            projectName	项目名称
     *            type	记工记账类型-1:个人记工,2:班组记工3:个人记账,,4:班组记账
     *            }
     * @return
     */
    @POST("settleProjectStandard/add")
    Call<BaseEntity> addProject(@Body Map<String, Object> map);

    /**
     * 删除项目
     *
     * @param no
     * @param phoneNumber
     * @param code
     * @return
     */
    @DELETE("settleProjectStandard/delete/{no}/{phoneNumber}/{code}")
    Call<BaseEntity> delProject(@Path("no") String no, @Path("phoneNumber") String phoneNumber, @Path("code") String code);

    @GET("team/common/sendCode")
    Call<BaseEntity> sendCode(@Query("telPhone") String telPhone);

    @POST("settleProjectStandard/getProjectPage")
    Call<BaseEntity<ListResponse<List<ProjectEntity>>>> getProjectList(@Body Map<String, Object> map);

    /**
     * 记工流水列表
     *
     * @param map
     * @return
     */
    @POST("settlePointWork/workRecords")
    Call<BaseEntity> getWorkRecords(@Body Map<String, Object> map);

    /**
     * 添加-编辑 个人记工 点工
     *
     * @param files 参数 {
     *              "haveWorkOvertime": "",
     *              "no": "",
     *              "picture": "",
     *              "projectName": "",
     *              "projectNo": "",
     *              "recordType": "",
     *              "remark": "",
     *              "salary": 0,
     *              "userNo": "",
     *              "workDuration": 0,
     *              "workNoList": [],
     *              "workOvertimeDuration": 0,
     *              "workOvertimeSalary": 0,
     *              "workOvertimeStandard": 0,
     *              "workOvertimeType": "",
     *              "workStandard": 0,
     *              "workStandardSalary": 0,
     *              "workTime": "2021-11-15,2021-11-06",
     *              "workType": ""
     *              }
     * @return
     */
    @POST("settlePointWork/add")
    Call<BaseEntity> uploadWork(@Body Map<String, Object> files);

    /**
     * 添加-编辑 个人记工 包工
     *
     * @param files 参数 {
     *              "no": "",
     *              "picture": "",
     *              "projectName": "",
     *              "projectNo": "",
     *              "quantities": 0,
     *              "quantitiesUnit": "1,2,3",
     *              "recordType": "",
     *              "remark": "",
     *              "salary": 0,
     *              "unitPrice": 0,
     *              "userNo": "",
     *              "workNoList": [],
     *              "workTime": 1636300800000
     *              }
     * @return
     */
    @POST("settleWrapWork/add")
    Call<BaseEntity> uploadDayWork(@Body Map<String, Object> files);

    /**
     * 日历按天统计
     *
     * @param files 参数 {
     *              "day": "",
     *              "month": "",
     *              "projectNo": "",
     *              "type": "",
     *              "year": ""
     *              }
     * @return
     */
    @POST("settlePointWork/calendarStatistics")
    Call<BaseEntity<List<PressDayCalendarEntity>>> pressDay(@Body Map<String, Object> files);

    /**
     * 记账流水分页列表(包含分页)
     *
     * @param files 参数 {
     *              "day": "",
     *              "limit": 0,
     *              "month": "",
     *              "page": 0,
     *              "projectNo": "",
     *              "type": "",
     *              "year": ""
     *              }
     * @return
     */
    @POST("settlePointWork/workRecordsPage")
    Call<BaseEntity<ListResponse<List<WorkTakeEntity>>>> takeWorkAccount(@Body Map<String, Object> files);

    /**
     * 点工详情
     */
    @GET("settlePointWork/detail/{no}/{type}")
    Call<BaseEntity<WorkRecordsEntity>> pointWorkDetail(@Path("no") String no, @Path("type") String type);

    /**
     * 包工详情
     */
    @GET("settleWrapWork/detail/{no}/{type}")
    Call<BaseEntity<ContractLaborEntity>> wrapWorkDetail(@Path("no") String no, @Path("type") String type);

    /**
     * 记工统计
     *
     * @param param
     */
    @POST("settleProjectStandard/getWorkStatistics")
    Call<BaseEntity<ListResponse<List<WorkStatisticsEntity>>>> getWorkStatistics(@Body Map<String, Object> param);

    /**
     * 删除点工
     *
     * @param no
     * @return
     */
    @DELETE("settlePointWork/delete/{no}")
    Call<BaseEntity> delPoint(@Path("no") String no);

    /**
     * 删除包工
     *
     * @param no
     * @return
     */
    @DELETE("settleWrapWork/delete/{no}")
    Call<BaseEntity> delJobWork(@Path("no") String no);

    /**
     * 记工统计
     *
     * @param param {
     *              "dimension": "",
     *              "limit": 0,
     *              "month": "",
     *              "page": 0,
     *              "projectNo": "",
     *              "recordType": "",
     *              "year": ""
     *              }
     */
    @POST("settleProjectStandard/getWorkStatisticsAll")
    Call<BaseEntity<ProjectTakeEntity>> projectTake(@Body Map<String, Object> param);

    /**
     * 工资标准
     *
     * @param projectNo 项目的no
     * @param type      记工的类型
     * @return
     */
    @GET("settlePointSalaryStandard/latestSalaryStandard")
    Call<BaseEntity<SalaryStandardEntity>> salaryStandard(@Query("projectNo") String projectNo, @Query("type") String type);

    /**
     * 新增修改工资标准
     * @param param {
     *              "no": "",
     *              "projectName": "",
     *              "projectNo": "",
     *              "type": "",
     *              "userNo": "",
     *              "workOvertimeSalary": 0,
     *              "workOvertimeStandard": 0,
     *              "workOvertimeType": "",
     *              "workStandard": 0,
     *              "workStandardSalary": 0
     *              }
     * @return
     */
    @POST("settlePointSalaryStandard/add")
    Call<BaseEntity<BaseEntity>> addSalaryStandard(@Body Map<String, Object> param);

    /**
     * 删除工资标准
     *
     * @param no
     * @return
     */
    @DELETE("settlePointSalaryStandard/delete/{no}")
    Call<BaseEntity> delSalaryStandard(@Path("no") String no);
}
